//
//  MJRefreshNormalHeader+Present.swift
//  VIP借
//
//  Created by slience on 2019/3/15.
//  Copyright © 2019年 sanwenqian. All rights reserved.
//


import MJRefresh


extension MJRefreshNormalHeader {
    static func makeHeader(_ target: Any, refreshingAction action: Selector) -> MJRefreshNormalHeader {
        let header = MJRefreshNormalHeader()
        header.setRefreshingTarget(target, refreshingAction: action)
        header.lastUpdatedTimeLabel.isHidden = true
        header.setTitle("下拉刷新", for: .idle)
        header.setTitle("释放立即刷新", for: .pulling)
        header.setTitle("正在使劲刷新", for: .refreshing)
        return header
    }
    
    func presentRefreshDate(_ date: Date?) {
        if let date = date {
//            setTitle("下拉刷新，最近更新：" + Dates.format2(date: date), for: .idle)
        } else {
            setTitle("下拉刷新", for: .idle)
        }
    }
}

extension MJRefreshBackNormalFooter {
    static func makeFooter(_ target: Any, refreshingAction action: Selector) -> MJRefreshBackNormalFooter {
        let footer = MJRefreshBackNormalFooter()
        footer.setRefreshingTarget(target, refreshingAction: action)
        //footer.lastUpdatedTimeLabel.isHidden = true
        footer.setTitle("上拉加载", for: .idle)
        footer.setTitle("释放立即加载", for: .pulling)
        footer.setTitle("正在使劲加载", for: .refreshing)

        return footer
    }
    
    func presentRefreshDate(_ date: Date?) {
        if let date = date {
//            setTitle("上拉加载，最近加载：" + Dates.format2(date: date), for: .idle)
        } else {
            setTitle("上拉加载", for: .idle)
        }
    }
}
